<template>
    <div class="left-chart-3" ref="chart">
      <div class="lc3-header">中台系统监控</div>
        <dv-scroll-board :config="config" style="width:100%;height:100%" />
    </div>
</template>

<script >
import { getOyMetrics } from "@/api/metrics"
export default {
  name: 'LeftChart3',
  data: function () {
    return {
      config: {
        data: []
      }
    }
  },
  mounted () {
    this.loadData()
    // eslint-disable-next-line no-unused-vars
    this.timer = setInterval(this.loadData, 1000 * 60)
  },
  beforeDestroy () {
    clearInterval(this.timer)
  },
  methods: {
    loadData: function () {
      getOyMetrics().then(res => {
          this.config = {
            data: res.data.odMetrics,
            header: ['模块', 'IP', 'JVM', '线程', '状态'],
            align: ['left'],
            rowNum: 8,
            headerBGC: '#061423',
            columnWidth: [120, 75, 75, 55, 65],
            headerHeight: 50,
            oddRowBGC: 'rgba(4,18,29,0.8)',
            evenRowBGC: 'rgb(5,40,73)',
            carousel: 'page',
            waitTime: '4000'
          }// this.data = res
        })
        .catch(function (res) {
          console.log(res)
        })
    }
  }
}
</script>

<style lang="less">
.left-chart-3 {
  width: 100%;
  height: 35%;
  display: flex;
  flex-direction: column;

  .lc3-header {
    text-align: center;
    height: 40px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 20px;
    margin-bottom: 10px;
  }

  .lc3-details {
    height: 40px;
    font-size: 16px;
    display: flex;
    align-items: center;
    text-indent: 20px;

    span {
      color: #096dd9;
      font-weight: bold;
      font-size: 35px;
      margin-left: 20px;
    }
  }

  .lc3-chart {
    flex: 1;
  }
}
</style>
